Skip to content

feat(db): add property registry table#1779

Open
kaligrafy wants to merge 4 commits intochairemobilite:mainfrom
kaligrafy:propertyRegistrySchema
Open

feat(db): add property registry table#1779
kaligrafy wants to merge 4 commits intochairemobilite:mainfrom
kaligrafy:propertyRegistrySchema

Conversation

@kaligrafy
Copy link
Collaborator

@kaligrafy kaligrafy commented Feb 12, 2026

Add two migrations to chaire-lib-backend:

  • Add 'propertyRegistry' to tr_data_source_types enum
  • Create tr_property_registry table with schema based on the Property Registry wiki documentation

The table supports international property/cadastral data with:

  • Integer PK with optional UUID
  • MultiPolygon geography for building/parcel footprints
  • Point geography for centroids and main entrance
  • Building characteristics (flats, floors, area, year built)
  • Assessment values and land use codes
  • Location metadata (country, region, municipality, borough)
  • FK to tr_data_sources for import tracking

Updates to capnp schema for data sources have also been updated. However, we should not need any capnp schema for data sources and zones, so they will be removed in the future. See #1778

See: https://github.com/chairemobilite/transition/wiki/Documentation-%E2%80%90-Property-Registry
Also see: #1691 (closes step 1)

Summary by CodeRabbit

  • New Features
    • Added Property Registry data source: DB table, full CRUD with PostGIS geo support, GeoJSON point/feature outputs, client model/types, and geometry conversion helper.
  • Tests
    • Extensive tests covering Property Registry DB flows, geo handling, batch operations, and geometry utility.
  • Chores
    • Dependency adjustments and serialization/schema mapping updates to support the new data source.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 6 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="packages/transition-backend/src/models/capnpDataModel/capnpFiles/dataSource.capnp">

<violation number="1" location="packages/transition-backend/src/models/capnpDataModel/capnpFiles/dataSource.capnp:31">
P1: Changing the numeric tag for the existing `unknown` enum value breaks backwards compatibility with previously serialized data. Keep `unknown` at @14 and assign the new value a new tag.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@coderabbitai
Copy link

coderabbitai bot commented Feb 12, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Adds a new "propertyRegistry" data source across the codebase: a DB enum migration and a migration that creates tr_property_registry with PostGIS geography columns and indexes; a geometry helper and geometry unit tests; a property registry TypeScript model and tests; a new DB queries module implementing CRUD, geo-queries, and GeoJSON output; updates to default query generics (introducing Idable); Cap'n Proto and Rust enum updates for the new data source; multiple tests exercising DB and model logic; and minor package dependency edits.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Suggested reviewers

  • greenscientist
  • tahini
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(db): add property registry table' clearly and specifically summarizes the main change—introducing a new property registry database table with schema.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot]

This comment was marked as resolved.

@kaligrafy kaligrafy force-pushed the propertyRegistrySchema branch from 7daf57e to 5c60929 Compare February 12, 2026 15:14
Copy link
Collaborator

@tahini tahini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bon, j'avais des commentaires pending...

Aussi, tel que discuté hors ligne, ce serait bien d'avoir les requêtes qui seront associées à cette table, afin de pouvoir mieux juger de l'utilisation qui en sera faite et, donc, de la validité des index/champs proposés.

@kaligrafy kaligrafy force-pushed the propertyRegistrySchema branch 2 times, most recently from 7622253 to b26c01b Compare February 23, 2026 23:39
@kaligrafy
Copy link
Collaborator Author

J'ai ajouté les requêtes et les tests associés.

@kaligrafy kaligrafy requested a review from tahini February 23, 2026 23:39
@kaligrafy kaligrafy force-pushed the propertyRegistrySchema branch from b26c01b to 37f693a Compare February 23, 2026 23:43
coderabbitai[bot]

This comment was marked as resolved.

@kaligrafy kaligrafy force-pushed the propertyRegistrySchema branch from 37f693a to ed5e928 Compare February 24, 2026 00:04
@greenscientist
Copy link
Collaborator

@kaligrafy Can you compare with the work that Paul did? See how close you are in the table structure? (If we can reconcile both that could be interesting in the future)

@kaligrafy kaligrafy force-pushed the propertyRegistrySchema branch from ed5e928 to bc713a0 Compare February 24, 2026 00:24
@kaligrafy
Copy link
Collaborator Author

kaligrafy commented Feb 24, 2026

@kaligrafy Can you compare with the work that Paul did? See how close you are in the table structure? (If we can reconcile both that could be interesting in the future)

The work of Paul is specified for Quebec only. Mine is for any property registry databse and should be generic to most countries.

All the columns he used in his projects are indeed included in the table schema implemented here.

@kaligrafy kaligrafy force-pushed the propertyRegistrySchema branch from bc713a0 to 5cff0b4 Compare February 24, 2026 00:32
coderabbitai[bot]

This comment was marked as resolved.

@kaligrafy kaligrafy force-pushed the propertyRegistrySchema branch from 5cff0b4 to 3f867a2 Compare February 24, 2026 00:42
coderabbitai[bot]

This comment was marked as resolved.

Copy link
Collaborator

@tahini tahini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

qq petits commentaires et réponses, je ferai un review plus complet demain.

@kaligrafy kaligrafy force-pushed the propertyRegistrySchema branch from 3f867a2 to d1bf5e2 Compare February 24, 2026 01:16
@kaligrafy kaligrafy requested a review from tahini February 24, 2026 01:17
coderabbitai[bot]

This comment was marked as resolved.

@kaligrafy kaligrafy force-pushed the propertyRegistrySchema branch 2 times, most recently from 1518510 to b5dc442 Compare February 25, 2026 19:28
@kaligrafy kaligrafy force-pushed the propertyRegistrySchema branch from b5dc442 to b83c802 Compare February 26, 2026 15:54
@kaligrafy kaligrafy requested a review from tahini February 26, 2026 15:54
@kaligrafy kaligrafy force-pushed the propertyRegistrySchema branch from b83c802 to 26f5760 Compare February 26, 2026 16:59
The util function does convert geojson input into a postgis raw query string.
If the geojson input is undefined, it will return undefined.

This conversion operation is repeated in every db insert query where at least one column is of type geom or geog.
Now, we will be able to use this util instead.
Data source type did not include property registry
The capnp enum was also updated.
Update to capnp schema used services/json2capnp/transition_capnp_data/src/capnp/_generating_classes.txt
Accept Idable instead of GenericObject so we can
input custom objects with at least an id (number of string)

Right now, the default queries only accept GenericObject, but new
classes will not have some of the attributes in GenericObject.
To make any object with at least an id to be able to use these query
templates, we need to change the input type to a simple Idable.
Includes:
- db queries
- associated types
- tests

New package:
- iso-3166-ts (for the country field so we make it standard two-letter country code)

completes step 1 of chairemobilite#1691
@kaligrafy kaligrafy force-pushed the propertyRegistrySchema branch from 26f5760 to 6799be2 Compare February 26, 2026 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants